<template>
	<uni-easyinput v-model="FBillNo" :placeholderStyle="placeholderStyle" :styles="styles" disabled></uni-easyinput>
</template>

<script>
	import {
	  uniEasyinput
	} from "@dcloudio/uni-ui"
	let myno = ''
	export default {
		props: {
		    prestr: { //前缀
		        type: String,
		        default: ''
		    },
			changeFlag: { //前缀
			    type: Boolean,
			    default: false
			}
		},
		data() {
		  return {
			  placeholderStyle:'font-size:17px',
			  styles:{
			  	//borderColor: '#999'
			  },
			  FBillNo:''
			}
		},
		components: {
			uniEasyinput
		},
		mounted(){
			if(myno==''){
				this.getCode()
			}else{
				this.FBillNo = myno
			} 
		},
		methods:{
			getCode:function(e){
				let today = this.$Func.getDateTime('today','Ymd')
				this.$Db.setMcode(today, this.prestr).then(res => {
					this.FBillNo = res
					myno = res
					uni.$emit('autoFBillNo',res)
				});
			}
		}
	}
</script>